<?php
function get_students_list($userid){
	$query="SELECT * FROM USER WHERE USERGROUP=$userid AND LEVEL=".STUDENT." ORDER BY USERID";
	$result=mysql_query($query);
	return $result;
}
function del_students_list($userid){
	$query="DELETE FROM schedule WHERE USERID=$userid";
	mysql_query($query);
	
	$query="DELETE FROM qacomment WHERE AUTHOR=$userid";
	mysql_query($query);
	
	$query="DELETE FROM qacomment WHERE TITLEID IN(SELECT Id FROM qa WHERE AUTHOR=$userid)";
	mysql_query($query);
	
	$query="DELETE FROM qa WHERE AUTHOR=$userid";
	mysql_query($query);
	
	$query="DELETE FROM report WHERE USERID=$userid";
	mysql_query($query);
	
	$query="DELETE FROM thesis WHERE AUTHOR=$userid";
	mysql_query($query);
	
	$query="DELETE FROM user WHERE USERID=$userid AND LEVEL=".STUDENT;
	mysql_query($query);
}
?>
